#ifndef __CC_XML_TREE_PARSER_H__
#define __CC_XML_TREE_PARSER_H__

#include <stdint.h>
#include <libcc_stl/list.h>

typedef int (*value_check_fp)(const char* value, void* args);
typedef void (*value_init_fp)(const char* value, const char* node_name, const char* attrib_name, void* args);

struct xml_parser_tree_node
{
    struct list_head list;      // to its borthers.
    char name[128];
    int type;
    int level;
    struct list_head children;  // to its child nodes.
    struct list_head attribs;   // to its attribs.
};

struct xml_parser_tree_leaf
{
    struct list_head list;          // to its brothers
    char name[128];
    value_check_fp check_fp;
    value_init_fp init_fp;
};

struct xml_parser_tree_node* push_xp_node(struct xml_parser_tree_node* parent, const char* name, int type, int level);
void joint_xp_node(struct xml_parser_tree_node* parent, struct xml_parser_tree_node* child);
void pop_xp_node(struct xml_parser_tree_node* p);
struct xml_parser_tree_leaf* push_xp_attrib(
    struct xml_parser_tree_node* p,
    const char* name,
    value_check_fp check_fp,
    value_init_fp init_fp
);
void pop_xp_attrib(struct xml_parser_tree_leaf* p);




#endif

